home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Comm / term-source.lha / Extras / Source / term-Source.lha / CapturePanel.c < prev    next >
C/C++ Source or Header  |  1995-06-17  |  21KB  |  862 lines

  1. /*
  2. **    CapturePanel.c
  3. **
  4. **    Editing panel for log file, buffer and capture configuration
  5. **
  6. **    Copyright © 1990-1995 by Olaf `Olsen' Barthel
  7. **        All Rights Reserved
  8. */
  9.  
  10. #include "termGlobal.h"
  11.  
  12. enum    {    GAD_LOGACTIONS, GAD_LOGFILE, GAD_SELECT_LOGFILE, GAD_LOGCALLS, GAD_CALL_LOGFILE,GAD_SELECT_CALL_LOGFILE,
  13.         GAD_MAX_BUFFER_SIZE,GAD_BUFFER_ENABLED,GAD_BUFFER_PATH,GAD_SELECT_BUFFER_PATH,
  14.         GAD_CONNECT_AUTO_CAPTURE, GAD_AUTOCAPTURE_DATE, GAD_CAPTURE_FILTER, GAD_CONVERT_CHARS,
  15.         GAD_CAPTURE_PATH, GAD_SELECT_CAPTURE_PATH, GAD_OPEN_BUFFER_WINDOW,
  16.         GAD_REMEMBER_WINDOW_POS,GAD_OPEN_BUFFER_SCREEN,GAD_REMEMBER_SCREEN_POS,GAD_SEARCH_HISTORY,
  17.         GAD_SCREENMODE,GAD_BUFFERSCREEN_POSITION,GAD_BUFFERWIDTH,GAD_USE, GAD_CANCEL, GAD_DEFAULT,
  18.         GAD_PAGER, GAD_PAGEGROUP,
  19.     };
  20.  
  21. STATIC BYTE  __regargs
  22. SelectDisplayMode(struct Window *Window,ULONG *CurrentMode,struct Configuration *Config)
  23. {
  24.     BYTE Success = FALSE;
  25.  
  26.     if(!Kick30)
  27.     {
  28.         struct List    *ModeList;
  29.         LONG         Index;
  30.  
  31.         if(ModeList = BuildModeList(&Index,*CurrentMode,NULL))
  32.         {
  33.             struct LayoutHandle *Handle;
  34.  
  35.             if(Handle = LT_CreateHandleTags(Window -> WScreen,
  36.                 LH_LocaleHook,    &LocaleHook,
  37.             TAG_DONE))
  38.             {
  39.                 struct Window *LocalWindow;
  40.  
  41.                 LT_New(Handle,
  42.                     LA_Type,    VERTICAL_KIND,
  43.                 TAG_DONE);
  44.                 {
  45.                     LT_New(Handle,
  46.                         LA_Type,    VERTICAL_KIND,
  47.                     TAG_DONE);
  48.                     {
  49.                         LT_New(Handle,
  50.                             LA_Type,    LISTVIEW_KIND,
  51.                             LA_LabelID,    MSG_V36_0160,
  52.                             GTLV_Labels,    ModeList,
  53.                             LA_LONG,    &Index,
  54.                             LALV_CursorKey,    TRUE,
  55.                             LALV_Link,    NIL_LINK,
  56.                             LALV_MaxGrowY,    20,
  57.                             LALV_ResizeY,    TRUE,
  58.                             LA_Lines,    10,
  59.                             LA_Chars,    40,
  60.                             LA_CursorKey,    TRUE,
  61.                         TAG_DONE);
  62.  
  63.                         LT_EndGroup(Handle);
  64.                     }
  65.  
  66.                     LT_New(Handle,
  67.                         LA_Type,VERTICAL_KIND,
  68.                     TAG_DONE);
  69.                     {
  70.                         LT_New(Handle,
  71.                             LA_Type,    XBAR_KIND,
  72.                             LAXB_FullSize,    TRUE,
  73.                         TAG_DONE);
  74.  
  75.                         LT_EndGroup(Handle);
  76.                     }
  77.  
  78.                     LT_New(Handle,LA_Type,HORIZONTAL_KIND,
  79.                         LAGR_SameSize,    TRUE,
  80.                         LAGR_Spread,    TRUE,
  81.                     TAG_DONE);
  82.                     {
  83.                         LT_New(Handle,
  84.                             LA_Type,    BUTTON_KIND,
  85.                             LA_LabelID,    MSG_GLOBAL_USE_GAD,
  86.                             LA_ID,        GAD_USE,
  87.                             LABT_ReturnKey,    TRUE,
  88.                             LABT_ExtraFat,    TRUE,
  89.                         TAG_DONE);
  90.  
  91.                         LT_New(Handle,
  92.                             LA_Type,    BUTTON_KIND,
  93.                             LA_LabelID,    MSG_GLOBAL_CANCEL_GAD,
  94.                             LA_ID,        GAD_CANCEL,
  95.                             LABT_EscKey,    TRUE,
  96.                             LABT_ExtraFat,    TRUE,
  97.                         TAG_DONE);
  98.  
  99.                         LT_EndGroup(Handle);
  100.                     }
  101.  
  102.                     LT_EndGroup(Handle);
  103.                 }
  104.  
  105.                 if(LocalWindow = LT_Layout(Handle,LocaleString(MSG_V36_0161),NULL,0,0,IDCMP_CLOSEWINDOW,NULL,
  106.                     LAWN_HelpHook,        &GuideHook,
  107.                     LAWN_Parent,        Window,
  108.                     WA_DepthGadget,        TRUE,
  109.                     WA_CloseGadget,        TRUE,
  110.                     WA_DragBar,        TRUE,
  111.                     WA_RMBTrap,        TRUE,
  112.                     WA_Activate,        TRUE,
  113.                 TAG_DONE))
  114.                 {
  115.                     struct IntuiMessage    *Message;
  116.                     BOOL             Done = FALSE;
  117.                     ULONG             MsgClass,
  118.                                  MsgQualifier;
  119.                     UWORD             MsgCode;
  120.                     struct Gadget        *MsgGadget;
  121.                     LONG             i;
  122.                     struct ModeNode        *ModeNode;
  123.  
  124.                     do
  125.                     {
  126.                         WaitPort(LocalWindow -> UserPort);
  127.  
  128.                         while(Message = (struct IntuiMessage *)LT_GetIMsg(Handle))
  129.                         {
  130.                             MsgClass    = Message -> Class;
  131.                             MsgCode        = Message -> Code;
  132.                             MsgQualifier    = Message -> Qualifier;
  133.                             MsgGadget    = (struct Gadget *)Message -> IAddress;
  134.  
  135.                             LT_ReplyIMsg(Message);
  136.  
  137.                             if(MsgClass == IDCMP_CLOSEWINDOW)
  138.                                 Done = TRUE;
  139.  
  140.                             if(MsgClass == IDCMP_GADGETUP)
  141.                             {
  142.                                 switch(MsgGadget -> GadgetID)
  143.                                 {
  144.                                     case GAD_USE:
  145.  
  146.                                         for(ModeNode = (struct ModeNode *)ModeList -> lh_Head, i = 0 ; ModeNode -> VanillaNode . ln_Succ ; ModeNode = (struct ModeNode *)ModeNode -> VanillaNode . ln_Succ, i++)
  147.                                         {
  148.                                             if(Index == i)
  149.                                             {
  150.                                                 *CurrentMode = ModeNode -> DisplayID;
  151.  
  152.                                                 break;
  153.                                             }
  154.                                         }
  155.  
  156.                                         Success = Done = TRUE;
  157.                                         break;
  158.  
  159.                                     case GAD_CANCEL:
  160.  
  161.                                         Done = TRUE;
  162.                                         break;
  163.                                 }
  164.                             }
  165.  
  166.                             if(MsgClass == IDCMP_IDCMPUPDATE)
  167.                             {
  168.                                 for(ModeNode = (struct ModeNode *)ModeList -> lh_Head, i = 0; ModeNode -> VanillaNode . ln_Succ ; ModeNode = (struct ModeNode *)ModeNode -> VanillaNode . ln_Succ, i++)
  169.                                 {
  170.                                     if(Index == i)
  171.                                     {
  172.                                         *CurrentMode = ModeNode -> DisplayID;
  173.  
  174.                                         Success = Done = TRUE;
  175.  
  176.                                         LT_PressButton(Handle,GAD_USE);
  177.  
  178.                                         break;
  179.                                     }
  180.                                 }
  181.                             }
  182.                         }
  183.                     }
  184.                     while(!Done);
  185.                 }
  186.  
  187.                 LT_DeleteHandle(Handle);
  188.             }
  189.  
  190.             DeleteList(ModeList);
  191.         }
  192.     }
  193.     else
  194.     {
  195.         struct ScreenModeRequester    *Request;
  196.         struct TagItem             DimensionTags[5];
  197.  
  198.         if(Request = (struct ScreenModeRequester *)AllocAslRequestTags(ASL_ScreenModeRequest,
  199.             ASLSM_Window,            Window,
  200.             ASLSM_InitialDisplayID,        *CurrentMode,
  201.             ASLSM_PrivateIDCMP,        TRUE,
  202.         TAG_MORE,GetDimensionTags(Window,DimensionTags)))
  203.         {
  204.             if(AslRequestTags(Request,TAG_DONE))
  205.             {
  206.                 PutDimensionTags(Window,Request -> sm_LeftEdge,Request -> sm_TopEdge,Request -> sm_Width,Request -> sm_Height);
  207.  
  208.                 *CurrentMode = Request -> sm_DisplayID;
  209.  
  210.                 Success = TRUE;
  211.             }
  212.  
  213.             FreeAslRequest(Request);
  214.         }
  215.     }
  216.  
  217.     return(Success);
  218. }
  219.  
  220. BYTE __regargs
  221. CapturePanel(struct Configuration *Config,BYTE *Default)
  222. {
  223.     STATIC LONG PageTitleID[7] =
  224.     {
  225.         MSG_V36_0008,
  226.         MSG_V36_0009,
  227.         MSG_V36_0011,
  228.         MSG_V36_0013,
  229.         MSG_V36_0014,
  230.         MSG_CAPTUREPANEL_SERVICES_TXT,
  231.         -1
  232.     };
  233.  
  234.     STATIC BYTE InitialPage = 0;
  235.  
  236.     struct LayoutHandle    *Handle;
  237.     BYTE             Cancel = FALSE;
  238.     STRPTR             PageTitle[7];
  239.  
  240.     LocalizeStringTable(PageTitle,PageTitleID);
  241.  
  242.     SaveConfig(Config,PrivateConfig);
  243.  
  244.     if(Handle = LT_CreateHandleTags(Window -> WScreen,
  245.         LH_LocaleHook,    &LocaleHook,
  246.         LH_ExitFlush,    FALSE,
  247.     TAG_DONE))
  248.     {
  249.         struct Window    *PanelWindow;
  250.         BYTE         OpenBufferWindow = Config -> CaptureConfig -> OpenBufferWindow & 0xF,
  251.                  OpenBufferScreen = Config -> CaptureConfig -> OpenBufferScreen & 0xF;
  252.         UBYTE         ModeName[DISPLAYNAMELEN + 1];
  253.         ULONG         DisplayMode;
  254.  
  255.         DisplayMode = Config -> CaptureConfig -> BufferScreenMode;
  256.  
  257.         if(ModeNotAvailable(DisplayMode))
  258.         {
  259.             if(Config && Config -> ScreenConfig)
  260.                 DisplayMode = Config -> ScreenConfig -> DisplayMode;
  261.             else
  262.                 DisplayMode = INVALID_ID;
  263.         }
  264.  
  265.         if(ModeNotAvailable(DisplayMode))
  266.         {
  267.             struct Screen *PubScreen = LockPubScreen(NULL);
  268.  
  269.             if(PubScreen)
  270.             {
  271.                 DisplayMode = GetVPModeID(&PubScreen -> ViewPort);
  272.  
  273.                 UnlockPubScreen(NULL,PubScreen);
  274.             }
  275.             else
  276.                 DisplayMode = DEFAULT_MONITOR_ID | HIRES_KEY;
  277.         }
  278.  
  279.         strcpy(ModeName,GetModeName(DisplayMode));
  280.  
  281.         LT_New(Handle,
  282.             LA_Type,    VERTICAL_KIND,
  283.         TAG_DONE);
  284.         {
  285.             LT_New(Handle,
  286.                 LA_Type,VERTICAL_KIND,
  287.             TAG_DONE);
  288.             {
  289.                 LT_New(Handle,
  290.                     LA_Type,    CYCLE_KIND,
  291.                     LA_ID,        GAD_PAGER,
  292.                     LA_LabelID,    MSG_XFER_PAGE_TXT,
  293.                     GTCY_Labels,    PageTitle,
  294.                     LACY_AutoPageID,GAD_PAGEGROUP,
  295.                     LACY_TabKey,    TRUE,
  296.                     LA_BYTE,    &InitialPage,
  297.                 TAG_DONE);
  298.  
  299.                 LT_EndGroup(Handle);
  300.             }
  301.  
  302.             LT_New(Handle,
  303.                 LA_Type,    VERTICAL_KIND,
  304.                 LA_ID,        GAD_PAGEGROUP,
  305.                 LAGR_Frame,    TRUE,
  306.                 LAGR_ActivePage,InitialPage,
  307.             TAG_DONE);
  308.             {
  309.                 LT_New(Handle,
  310.                     LA_Type,    VERTICAL_KIND,
  311.                 TAG_DONE);
  312.                 {
  313.                     LT_New(Handle,
  314.                         LA_LabelID,    MSG_CAPTUREPANEL_LOG_ACTIONS_GAD,
  315.                         LA_Type,    CHECKBOX_KIND,
  316.                         LA_ID,        GAD_LOGACTIONS,
  317.                         LA_BYTE,    &Config -> CaptureConfig -> LogActions,
  318.                     TAG_DONE);
  319.  
  320.                     LT_New(Handle,
  321.                         LA_LabelID,    MSG_CAPTUREPANEL_LOGFILE_GAD,
  322.                         LA_Type,    STRING_KIND,
  323.                         LA_ID,        GAD_LOGFILE,
  324.                         LA_Chars,    20,
  325.                         LA_STRPTR,    Config -> CaptureConfig -> LogFileName,
  326.                         LAST_Picker,    TRUE,
  327.                         GTST_MaxChars,    MAX_FILENAME_LENGTH - 1,
  328.                     TAG_DONE);
  329.  
  330.                     LT_New(Handle,
  331.                         LA_Type,    XBAR_KIND,
  332.                     TAG_DONE);
  333.  
  334.                     LT_New(Handle,
  335.                         LA_LabelID,    MSG_CAPTUREPANEL_LOG_CALLS_GAD,
  336.                         LA_Type,    CHECKBOX_KIND,
  337.                         LA_ID,        GAD_LOGCALLS,
  338.                         LA_BYTE,    &Config -> CaptureConfig -> LogCall,
  339.                     TAG_DONE);
  340.  
  341.                     LT_New(Handle,
  342.                         LA_LabelID,    MSG_CAPTUREPANEL_CALL_LOGFILE_GAD,
  343.                         LA_Type,    STRING_KIND,
  344.                         LA_ID,        GAD_CALL_LOGFILE,
  345.                         LA_STRPTR,    Config -> CaptureConfig -> CallLogFileName,
  346.                         LAST_Picker,    TRUE,
  347.                         GTST_MaxChars,    MAX_FILENAME_LENGTH - 1,
  348.                     TAG_DONE);
  349.  
  350.                     LT_EndGroup(Handle);
  351.                 }
  352.  
  353.                 LT_New(Handle,
  354.                     LA_Type,    VERTICAL_KIND,
  355.                 TAG_DONE);
  356.                 {
  357.                     LT_New(Handle,
  358.                         LA_LabelID,    MSG_CAPTUREPANEL_BUFFER_ENABLED_GAD,
  359.                         LA_Type,    CHECKBOX_KIND,
  360.                         LA_ID,        GAD_BUFFER_ENABLED,
  361.                         LA_BYTE,    &Config -> CaptureConfig -> BufferEnabled,
  362.                     TAG_DONE);
  363.  
  364.                     LT_New(Handle,
  365.                         LA_LabelID,        MSG_CAPTUREPANEL_MAX_BUFFER_SIZE_GAD,
  366.                         LA_Type,        INTEGER_KIND,
  367.                         LA_ID,            GAD_MAX_BUFFER_SIZE,
  368.                         LA_LONG,        &Config -> CaptureConfig -> MaxBufferSize,
  369.                         LAIN_UseIncrementers,    TRUE,
  370.                         LAIN_Min,        0,
  371.                     TAG_DONE);
  372.  
  373.                     LT_New(Handle,
  374.                         LA_LabelID,    MSG_CAPTUREPANEL_BUFFER_PATH_GAD,
  375.                         LA_Type,    STRING_KIND,
  376.                         LA_ID,        GAD_BUFFER_PATH,
  377.                         LA_STRPTR,    Config -> CaptureConfig -> BufferPath,
  378.                         LAST_Picker,    TRUE,
  379.                         LA_Chars,    20,
  380.                         GTST_MaxChars,    MAX_FILENAME_LENGTH - 1,
  381.                     TAG_DONE);
  382.  
  383.                     LT_New(Handle,
  384.                         LA_LabelID,        MSG_CAPTUREPANEL_BUFFER_LINE_WIDTH_GAD,
  385.                         LA_Type,        SliderType,
  386.                         LA_ID,            GAD_BUFFERWIDTH,
  387.                         LA_UBYTE,        &Config -> CaptureConfig -> BufferWidth,
  388.                         GTSL_Min,        80,
  389.                         GTSL_Max,        BUFFER_LINE_MAX,
  390.                         GTSL_LevelFormat,    "%3ld",
  391.                     TAG_DONE);
  392.  
  393.                     LT_EndGroup(Handle);
  394.                 }
  395.  
  396.                 LT_New(Handle,
  397.                     LA_Type,    VERTICAL_KIND,
  398.                 TAG_DONE);
  399.                 {
  400.                     LT_New(Handle,
  401.                         LA_Type,    VERTICAL_KIND,
  402.                     TAG_DONE);
  403.                     {
  404.                         LT_New(Handle,
  405.                             LA_LabelID,    MSG_CAPTUREPANEL_CONNECT_AUTO_CAPTURE_GAD,
  406.                             LA_Type,    CHECKBOX_KIND,
  407.                             LA_ID,        GAD_CONNECT_AUTO_CAPTURE,
  408.                             LA_BYTE,    &Config -> CaptureConfig -> ConnectAutoCapture,
  409.                         TAG_DONE);
  410.  
  411.                         LT_New(Handle,
  412.                             LA_LabelID,    MSG_CAPTUREPANEL_CAPTURE_FILTER_ENABLED_GAD,
  413.                             LA_Type,    CHECKBOX_KIND,
  414.                             LA_ID,        GAD_CAPTURE_FILTER,
  415.                             LA_BYTE,    &Config -> CaptureConfig -> CaptureFilterMode,
  416.                         TAG_DONE);
  417.  
  418.                         LT_New(Handle,
  419.                             LA_LabelID,    MSG_CONVERT_CHARACTERS_GAD,
  420.                             LA_Type,    CHECKBOX_KIND,
  421.                             LA_BYTE,    &Config -> CaptureConfig -> ConvertChars,
  422.                             GA_Disabled,    !Config -> CaptureConfig -> CaptureFilterMode,
  423.                             LA_ID,        GAD_CONVERT_CHARS,
  424.                         TAG_DONE);
  425.  
  426.                         LT_EndGroup(Handle);
  427.                     }
  428.  
  429.                     LT_New(Handle,
  430.                         LA_Type,    VERTICAL_KIND,
  431.                     TAG_DONE);
  432.                     {
  433.                         LT_New(Handle,
  434.                             LA_LabelID,    MSG_CAPTUREPANEL_CREATION_DATE_GAD,
  435.                             LA_Type,    CYCLE_KIND,
  436.                             LA_ID,        GAD_AUTOCAPTURE_DATE,
  437.                             LA_BYTE,    &Config -> CaptureConfig -> AutoCaptureDate,
  438.                             LACY_FirstLabel,MSG_CAPTUREPANEL_APPEND_DATE_TXT,
  439.                             LACY_LastLabel,    MSG_CAPTUREPANEL_WRITE_DATE_TO_FILE_TXT,
  440.                         TAG_DONE);
  441.  
  442.                         LT_New(Handle,
  443.                             LA_LabelID,    MSG_CAPTUREPANEL_CAPTURE_PATH_GAD,
  444.                             LA_Type,    STRING_KIND,
  445.                             LA_ID,        GAD_CAPTURE_PATH,
  446.                             LA_Chars,    20,
  447.                             LA_STRPTR,    Config -> CaptureConfig -> CapturePath,
  448.                             LAST_Picker,    TRUE,
  449.                             GTST_MaxChars,    MAX_FILENAME_LENGTH - 1,
  450.                             LA_ExtraSpace,    TRUE,
  451.                         TAG_DONE);
  452.  
  453.                         LT_EndGroup(Handle);
  454.                     }
  455.  
  456.                     LT_EndGroup(Handle);
  457.                 }
  458.  
  459.                 LT_New(Handle,
  460.                     LA_Type,    VERTICAL_KIND,
  461.                 TAG_DONE);
  462.                 {
  463.                     LT_New(Handle,
  464.                         LA_LabelID,    MSG_CAPTUREPANEL_OPEN_BUFFER_WINDOW_GAD,
  465.                         LA_Type,    MX_KIND,
  466.                         LA_ID,        GAD_OPEN_BUFFER_WINDOW,
  467.                         LA_BYTE,    &OpenBufferWindow,
  468.                         LAMX_FirstLabel,MSG_CAPTUREPANEL_TOP_TXT,
  469.                         LAMX_LastLabel,    MSG_CAPTUREPANEL_END_TXT,
  470.                     TAG_DONE);
  471.  
  472.                     LT_New(Handle,
  473.                         LA_LabelID,    MSG_CAPTUREPANEL_REMEMBER_BUFFER_WINDOW_GAD,
  474.                         LA_Type,    CHECKBOX_KIND,
  475.                         LA_ID,        GAD_REMEMBER_WINDOW_POS,
  476.                         LA_BYTE,    &Config -> CaptureConfig -> RememberBufferWindow,
  477.                         LA_ExtraSpace,    TRUE,
  478.                     TAG_DONE);
  479.  
  480.                     LT_EndGroup(Handle);
  481.                 }
  482.  
  483.                 LT_New(Handle,
  484.                     LA_Type,    VERTICAL_KIND,
  485.                 TAG_DONE);
  486.                 {
  487.                     LT_New(Handle,
  488.                         LA_Type,    VERTICAL_KIND,
  489.                     TAG_DONE);
  490.                     {
  491.                         LT_New(Handle,
  492.                             LA_LabelID,    MSG_CAPTUREPANEL_OPEN_BUFFER_SCREEN_GAD,
  493.                             LA_Type,    MX_KIND,
  494.                             LA_ID,        GAD_OPEN_BUFFER_SCREEN,
  495.                             LA_BYTE,    &OpenBufferScreen,
  496.                             LAMX_FirstLabel,MSG_CAPTUREPANEL_TOP_TXT,
  497.                             LAMX_LastLabel,    MSG_CAPTUREPANEL_END_TXT,
  498.                         TAG_DONE);
  499.  
  500.                         LT_New(Handle,
  501.                             LA_LabelID,    MSG_CAPTUREPANEL_REMEMBER_BUFFER_SCREEN_GAD,
  502.                             LA_Type,    CHECKBOX_KIND,
  503.                             LA_ID,        GAD_REMEMBER_SCREEN_POS,
  504.                             LA_BYTE,    &Config -> CaptureConfig -> RememberBufferScreen,
  505.                             LA_ExtraSpace,    TRUE,
  506.                         TAG_DONE);
  507.  
  508.                         LT_New(Handle,
  509.                             LA_Type,    XBAR_KIND,
  510.                         TAG_DONE);
  511.  
  512.                         LT_New(Handle,
  513.                             LA_LabelID,    MSG_CAPTUREPANEL_BUFFER_SCREEN_POSITION_GAD,
  514.                             LA_Type,    MX_KIND,
  515.                             LA_ID,        GAD_BUFFERSCREEN_POSITION,
  516.                             LA_BYTE,    &Config -> CaptureConfig -> BufferScreenPosition,
  517.                             LAMX_FirstLabel,MSG_CAPTUREPANEL_LEFT_TXT,
  518.                             LAMX_LastLabel,    MSG_CAPTUREPANEL_RIGHT_TXT,
  519.                         TAG_DONE);
  520.  
  521.                         LT_New(Handle,
  522.                             LA_Type,    XBAR_KIND,
  523.                         TAG_DONE);
  524.  
  525.                         LT_EndGroup(Handle);
  526.                     }
  527.  
  528.                     LT_New(Handle,
  529.                         LA_Type,    VERTICAL_KIND,
  530.                     TAG_DONE);
  531.                     {
  532.                         LT_New(Handle,
  533.                             LA_Type,    TEXT_KIND,
  534.                             LA_LabelID,    MSG_SCREENPANEL_CURRENT_DISPLAY_MODE_GAD,
  535.                             LA_Chars,    20,
  536.                             LA_ID,        GAD_SCREENMODE,
  537.                             GTTX_Text,    ModeName,
  538.                             GTTX_Border,    TRUE,
  539.                             LATX_Picker,    TRUE,
  540.                             LATX_LockSize,    TRUE,
  541.                         TAG_DONE);
  542.  
  543.                         LT_EndGroup(Handle);
  544.                     }
  545.  
  546.                     LT_EndGroup(Handle);
  547.                 }
  548.  
  549.                 LT_New(Handle,
  550.                     LA_Type,    VERTICAL_KIND,
  551.                 TAG_DONE);
  552.                 {
  553.                     if(Config -> CaptureConfig -> SearchHistory < 1)
  554.                         Config -> CaptureConfig -> SearchHistory = 10;
  555.  
  556.                     LT_New(Handle,
  557.                         LA_LabelID,        MSG_CAPTUREPANEL_SEARCH_HISTORY_GAD,
  558.                         LA_Type,        INTEGER_KIND,
  559.                         LA_ID,            GAD_SEARCH_HISTORY,
  560.                         LA_Chars,        8,
  561.                         LAIN_UseIncrementers,    TRUE,
  562.                         LAIN_Min,        1,
  563.                         LAIN_Max,        255,
  564.                         LA_BYTE,        &Config -> CaptureConfig -> SearchHistory,
  565.                     TAG_DONE);
  566.  
  567.                     LT_EndGroup(Handle);
  568.                 }
  569.  
  570.                 LT_EndGroup(Handle);
  571.             }
  572.  
  573.             LT_New(Handle,
  574.                 LA_Type,    VERTICAL_KIND,
  575.             TAG_DONE);
  576.             {
  577.                 LT_New(Handle,LA_Type,XBAR_KIND,LAXB_FullSize,TRUE,TAG_DONE);
  578.  
  579.                 LT_EndGroup(Handle);
  580.             }
  581.  
  582.             LT_New(Handle,LA_Type,HORIZONTAL_KIND,
  583.                 LAGR_SameSize,    TRUE,
  584.                 LAGR_Spread,    TRUE,
  585.             TAG_DONE);
  586.             {
  587.                 LT_New(Handle,
  588.                     LA_Type,    BUTTON_KIND,
  589.                     LA_LabelID,    MSG_GLOBAL_USE_GAD,
  590.                     LA_ID,        GAD_USE,
  591.                     LABT_ReturnKey,    TRUE,
  592.                     LABT_ExtraFat,    TRUE,
  593.                 TAG_DONE);
  594.  
  595.                 if(Default)
  596.                 {
  597.                     LT_New(Handle,
  598.                         LA_Type,    BUTTON_KIND,
  599.                         LA_LabelID,    MSG_GLOBAL_DEFAULT_GAD,
  600.                         LA_ID,        GAD_DEFAULT,
  601.                         LABT_ExtraFat,    TRUE,
  602.                     TAG_DONE);
  603.                 }
  604.  
  605.                 LT_New(Handle,
  606.                     LA_Type,    BUTTON_KIND,
  607.                     LA_LabelID,    MSG_GLOBAL_CANCEL_GAD,
  608.                     LA_ID,        GAD_CANCEL,
  609.                     LABT_EscKey,    TRUE,
  610.                     LABT_ExtraFat,    TRUE,
  611.                 TAG_DONE);
  612.  
  613.                 LT_EndGroup(Handle);
  614.             }
  615.  
  616.             LT_EndGroup(Handle);
  617.         }
  618.  
  619.         if(PanelWindow = LT_Layout(Handle,LocaleString(MSG_CAPTUREPANEL_CAPTURE_SETTINGS_TXT),NULL,0,0,IDCMP_CLOSEWINDOW,0,
  620.             LAWN_HelpHook,        &GuideHook,
  621.             LAWN_Parent,        Window,
  622.             WA_DepthGadget,        TRUE,
  623.             WA_CloseGadget,        TRUE,
  624.             WA_DragBar,        TRUE,
  625.             WA_RMBTrap,        TRUE,
  626.             WA_Activate,        TRUE,
  627.         TAG_DONE))
  628.         {
  629.             struct IntuiMessage    *Message;
  630.             BOOLEAN             Done = FALSE;
  631.             ULONG             MsgClass,
  632.                          MsgQualifier;
  633.             UWORD             MsgCode;
  634.             struct Gadget        *MsgGadget;
  635.             UBYTE             DummyBuffer[MAX_FILENAME_LENGTH],
  636.                         *DummyChar;
  637.             struct FileRequester    *FileRequest;
  638.  
  639.             GuideContext(CONTEXT_CAPTURE);
  640.  
  641.             PushWindow(PanelWindow);
  642.  
  643.             LT_ShowWindow(Handle,TRUE);
  644.  
  645.             do
  646.             {
  647.                 if(Wait(PORTMASK(PanelWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
  648.                 {
  649.                     SaveConfig(PrivateConfig,Config);
  650.  
  651.                     break;
  652.                 }
  653.  
  654.                 while(Message = LT_GetIMsg(Handle))
  655.                 {
  656.                     MsgClass    = Message -> Class;
  657.                     MsgQualifier    = Message -> Qualifier;
  658.                     MsgCode        = Message -> Code;
  659.                     MsgGadget    = (struct Gadget *)Message -> IAddress;
  660.  
  661.                     LT_ReplyIMsg(Message);
  662.  
  663.                     if(MsgClass == IDCMP_CLOSEWINDOW)
  664.                     {
  665.                         SaveConfig(PrivateConfig,Config);
  666.  
  667.                         Done = TRUE;
  668.                     }
  669.  
  670.                     if(MsgClass == IDCMP_GADGETUP)
  671.                     {
  672.                         switch(MsgGadget -> GadgetID)
  673.                         {
  674.                             case GAD_CAPTURE_FILTER:
  675.  
  676.                                 LT_SetAttributes(Handle,GAD_CONVERT_CHARS,
  677.                                     GA_Disabled,    !Config -> CaptureConfig -> CaptureFilterMode,
  678.                                 TAG_DONE);
  679.  
  680.                                 break;
  681.  
  682.                             case GAD_USE:
  683.  
  684.                                 LT_UpdateStrings(Handle);
  685.  
  686.                                 Config -> CaptureConfig -> OpenBufferWindow = OpenBufferWindow;
  687.                                 Config -> CaptureConfig -> OpenBufferScreen = OpenBufferScreen;
  688.                                 Config -> CaptureConfig -> BufferScreenMode = DisplayMode;
  689.  
  690.                                 Done = TRUE;
  691.                                 break;
  692.  
  693.                             case GAD_CANCEL:
  694.  
  695.                                 SaveConfig(PrivateConfig,Config);
  696.  
  697.                                 Cancel = Done = TRUE;
  698.                                 break;
  699.  
  700.                             case GAD_DEFAULT:
  701.  
  702.                                 *Default = TRUE;
  703.  
  704.                                 Done = TRUE;
  705.                                 break;
  706.  
  707.                             case GAD_LOGFILE:
  708.                             case GAD_CALL_LOGFILE:
  709.  
  710.                                 FindPath(PanelWindow,LT_GetString(Handle,MsgGadget -> GadgetID),TRUE,NULL);
  711.                                 break;
  712.  
  713.                             case GAD_BUFFER_PATH:
  714.                             case GAD_CAPTURE_PATH:
  715.  
  716.                                 FindDrawer(PanelWindow,LT_GetString(Handle,MsgGadget -> GadgetID),TRUE,NULL);
  717.                                 break;
  718.                         }
  719.                     }
  720.  
  721.                     if(MsgClass == IDCMP_IDCMPUPDATE)
  722.                     {
  723.                         switch(MsgGadget -> GadgetID)
  724.                         {
  725.                             case GAD_LOGFILE:
  726.  
  727.                                 LT_LockWindow(PanelWindow);
  728.  
  729.                                 strcpy(DummyBuffer,(STRPTR)LT_GetAttributes(Handle,MsgGadget -> GadgetID,TAG_DONE));
  730.  
  731.                                 if(DummyBuffer[0])
  732.                                 {
  733.                                     if(FilePart(DummyBuffer) == DummyBuffer)
  734.                                         DummyBuffer[0] = 0;
  735.                                     else
  736.                                     {
  737.                                         DummyChar = PathPart(DummyBuffer);
  738.  
  739.                                         *DummyChar = 0;
  740.                                     }
  741.  
  742.                                     DummyChar = FilePart((STRPTR)LT_GetAttributes(Handle,MsgGadget -> GadgetID,TAG_DONE));
  743.                                 }
  744.                                 else
  745.                                     DummyChar = "";
  746.  
  747.                                 if(FileRequest = GetFile(PanelWindow,LocaleString(MSG_CAPTUREPANEL_SELECT_LOGFILE_TXT),DummyBuffer,DummyChar,DummyBuffer,NULL,FALSE,FALSE,FALSE,LocaleString(MSG_GLOBAL_SELECT_TXT),TRUE))
  748.                                 {
  749.                                     FindPath(PanelWindow,DummyBuffer,TRUE,NULL);
  750.  
  751.                                     LT_SetAttributes(Handle,MsgGadget -> GadgetID,GTST_String,DummyBuffer,TAG_DONE);
  752.  
  753.                                     FreeAslRequest(FileRequest);
  754.                                 }
  755.  
  756.                                 LT_UnlockWindow(PanelWindow);
  757.                                 break;
  758.  
  759.                             case GAD_CALL_LOGFILE:
  760.  
  761.                                 LT_LockWindow(PanelWindow);
  762.  
  763.                                 strcpy(DummyBuffer,(STRPTR)LT_GetAttributes(Handle,MsgGadget -> GadgetID,TAG_DONE));
  764.  
  765.                                 if(DummyBuffer[0])
  766.                                 {
  767.                                     if(FilePart(DummyBuffer) == DummyBuffer)
  768.                                         DummyBuffer[0] = 0;
  769.                                     else
  770.                                     {
  771.                                         DummyChar = PathPart(DummyBuffer);
  772.  
  773.                                         *DummyChar = 0;
  774.                                     }
  775.  
  776.                                     DummyChar = FilePart((STRPTR)LT_GetAttributes(Handle,MsgGadget -> GadgetID,TAG_DONE));
  777.                                 }
  778.                                 else
  779.                                     DummyChar = "";
  780.  
  781.                                 if(FileRequest = GetFile(PanelWindow,LocaleString(MSG_CAPTUREPANEL_SELECT_CALL_LOGFILE_TXT),DummyBuffer,DummyChar,DummyBuffer,NULL,FALSE,FALSE,FALSE,LocaleString(MSG_GLOBAL_SELECT_TXT),TRUE))
  782.                                 {
  783.                                     FindPath(PanelWindow,DummyBuffer,TRUE,NULL);
  784.  
  785.                                     LT_SetAttributes(Handle,MsgGadget -> GadgetID,GTST_String,DummyBuffer,TAG_DONE);
  786.  
  787.                                     FreeAslRequest(FileRequest);
  788.                                 }
  789.  
  790.                                 LT_UnlockWindow(PanelWindow);
  791.                                 break;
  792.  
  793.                             case GAD_BUFFER_PATH:
  794.  
  795.                                 LT_LockWindow(PanelWindow);
  796.  
  797.                                 strcpy(DummyBuffer,(STRPTR)LT_GetAttributes(Handle,MsgGadget -> GadgetID,TAG_DONE));
  798.  
  799.                                 if(FileRequest = GetFile(PanelWindow,LocaleString(MSG_CAPTUREPANEL_SELECT_BUFFER_PATH_TXT),DummyBuffer,"",DummyBuffer,NULL,FALSE,FALSE,TRUE,LocaleString(MSG_GLOBAL_SELECT_TXT),TRUE))
  800.                                 {
  801.                                     FindDrawer(PanelWindow,DummyBuffer,TRUE,NULL);
  802.  
  803.                                     LT_SetAttributes(Handle,MsgGadget -> GadgetID,GTST_String,DummyBuffer,TAG_DONE);
  804.  
  805.                                     FreeAslRequest(FileRequest);
  806.                                 }
  807.  
  808.                                 LT_UnlockWindow(PanelWindow);
  809.                                 break;
  810.  
  811.                             case GAD_CAPTURE_PATH:
  812.  
  813.                                 LT_LockWindow(PanelWindow);
  814.  
  815.                                 strcpy(DummyBuffer,(STRPTR)LT_GetAttributes(Handle,MsgGadget -> GadgetID,TAG_DONE));
  816.  
  817.                                 if(FileRequest = GetFile(PanelWindow,LocaleString(MSG_CAPTUREPANEL_SELECT_CAPTURE_PATH_TXT),DummyBuffer,"",DummyBuffer,NULL,FALSE,FALSE,TRUE,LocaleString(MSG_GLOBAL_SELECT_TXT),TRUE))
  818.                                 {
  819.                                     FindDrawer(PanelWindow,DummyBuffer,TRUE,NULL);
  820.  
  821.                                     LT_SetAttributes(Handle,MsgGadget -> GadgetID,GTST_String,DummyBuffer,TAG_DONE);
  822.  
  823.                                     FreeAslRequest(FileRequest);
  824.                                 }
  825.  
  826.                                 LT_UnlockWindow(PanelWindow);
  827.                                 break;
  828.  
  829.                             case GAD_SCREENMODE:
  830.  
  831.                                 LT_LockWindow(PanelWindow);
  832.  
  833.                                 if(SelectDisplayMode(PanelWindow,&DisplayMode,Config))
  834.                                 {
  835.                                     strcpy(ModeName,GetModeName(DisplayMode));
  836.  
  837.                                     LT_SetAttributes(Handle,GAD_SCREENMODE,GTTX_Text,ModeName,TAG_DONE);
  838.                                 }
  839.  
  840.                                 LT_UnlockWindow(PanelWindow);
  841.  
  842.                                 LT_ShowWindow(Handle,TRUE);
  843.  
  844.                                 break;
  845.                         }
  846.                     }
  847.                 }
  848.             }
  849.             while(!Done);
  850.  
  851.             PopWindow();
  852.         }
  853.  
  854.         LT_DeleteHandle(Handle);
  855.     }
  856.  
  857.     if(Default)
  858.         return((BYTE)(!Cancel));
  859.     else
  860.         return((BYTE)memcmp(PrivateConfig -> CaptureConfig,Config -> CaptureConfig,sizeof(struct CaptureSettings)));
  861. }
  862.